home *** CD-ROM | disk | FTP | other *** search
/ Gamers Delight 2 / Gamers Delight 2.iso / Aminet / game / misc / randnpcs.lha / randnpcs.pas next >
Pascal/Delphi Source File  |  1994-01-25  |  12KB  |  384 lines

  1. Program Random_Characters(Input, Output);
  2.  
  3. uses crt;
  4.  
  5. Const
  6.    Version = 1.00;
  7.  
  8. var
  9.    Index : integer;
  10.    Char_File : text;
  11.    Num_Chars : integer;
  12.  
  13. Procedure Roll_Stats;
  14.  
  15. var
  16.    ST : integer;
  17.    IQ : integer;
  18.    DX : integer;
  19.    HT : integer;
  20.  
  21. begin
  22.    ST := random(5) + random(5) + random(5) + 3;
  23.    IQ := random(5) + random(5) + random(5) + 3;
  24.    DX := random(5) + random(5) + random(5) + 3;
  25.    HT := random(5) + random(5) + random(5) + 3;
  26.    Writeln(char_file, 'ST:',st,' IQ:',iq,' DX:',dx,' HT:',ht,' ');
  27. end;
  28.  
  29. Procedure Get_Advantage;
  30.  
  31. var
  32.    Advantage : integer;
  33.    rolls : integer;
  34.    Pass : integer;
  35.    Advantage_array : array[1..100] of integer;
  36.    Found : Boolean;
  37.    Index : integer;
  38.  
  39. begin
  40.    For Index := 1 to 100 do
  41.       Advantage_Array[Index] := 0;
  42.    rolls := 1;
  43.    Write(Char_file, 'Adavntage(s): ');
  44.    Pass := 0;
  45.    repeat
  46.       Pass := Pass + 1;
  47.       If (Pass > 1) and ((Pass mod 3) <> 0) then Write(Char_File, ', ');
  48.       Repeat
  49.          Advantage := Random(5) + Random(5) + Random(5) +3;
  50.          Found := False;
  51.          For Index := 1 to 100 do
  52.             If advantage = Advantage_array[index] then
  53.                found := true;
  54.       until not(found);
  55.       Case Advantage of
  56.          3,17,18 : Begin
  57.                       Rolls := 3;
  58.                       Pass := Pass - 1;
  59.                    end;
  60.          4 : Write(Char_File, 'Voice');
  61.          5 : Write(Char_File, 'Charisma(+6)');
  62.          6 : Write(Char_file, 'Alertness(+4)');
  63.          7 : Write(Char_File, 'Common Sense');
  64.          8 : Write(Char_File, 'Magical Aptitude(+2)');
  65.          9 : Write(Char_file, 'Acute Vision(+5)');
  66.          10 : Write(Char_File, 'Alertness(+2)');
  67.          11 : Write(Char_File, 'Charisma(+3)');
  68.          12 : Write(Char_File, 'Acute Taste/Smell(+5)');
  69.          13 : Write(Char_file, 'Danger Sense');
  70.          14 : Write(Char_file, 'Attractive Appearance');
  71.          15 : Write(Char_File, 'Acute Hearing(+5)');
  72.          16 : Write(Char_File, 'Handsome/Beautiful');
  73.       end;
  74.       if ((pass mod 3) = 0) and (pass <> 0) then
  75.       begin
  76.          writeln(char_file);
  77.          write(char_file, '              ');
  78.       end;
  79.       Rolls := Rolls - 1;
  80.    until rolls = 0;
  81.    writeln(Char_file);
  82. end;
  83.  
  84. Procedure Get_Disadvantage;
  85.  
  86. var
  87.    Disadvantage : integer;
  88.    rolls : integer;
  89.    Pass : integer;
  90.    Disadvantage_array : array[1..100] of integer;
  91.    Found : Boolean;
  92.    Index : integer;
  93.  
  94. begin
  95.    For Index := 1 to 100 do
  96.       Disadvantage_Array[Index] := 0;
  97.    rolls := 1;
  98.    Write(Char_file, 'Disadavntage(s): ');
  99.    Pass := 0;
  100.    repeat
  101.       Pass := Pass + 1;
  102.       If (Pass > 1) and ((Pass mod 3) <> 0) then Write(Char_File, ', ');
  103.       Repeat
  104.          Disadvantage := Random(5) + Random(5) + Random(5) +3;
  105.          Found := False;
  106.          For Index := 1 to 100 do
  107.             If disadvantage = disadvantage_array[index] then
  108.                found := true;
  109.       until not(found);
  110.       Case disadvantage of
  111.          3,17,18 : Begin
  112.                       Rolls := 3;
  113.                       Pass := Pass - 1;
  114.                    end;
  115.          4 : Write(Char_File, 'Poor');
  116.          5 : Write(Char_File, 'Cowardly');
  117.          6 : Write(Char_File, 'Overweight');
  118.          7 : Write(Char_file, 'Odious Personal Habit (-2)');
  119.          8 : Write(Char_File, 'Bad Temper');
  120.          9 : Write(Char_file, 'Unlucky');
  121.          10 : Write(Char_File, 'Greedy');
  122.          11 : Write(Char_File, 'Overconfident');
  123.          12 : Write(Char_File, 'Honest');
  124.          13 : Write(Char_file, 'Hard of Hearing');
  125.          14 : Write(Char_file, 'Unattractive Appearance');
  126.          15 : Write(Char_File, 'Bad Sight');
  127.          16 : Write(Char_File, 'Hideous Appearance');
  128.       end;
  129.       if ((pass mod 3) = 0) and (pass <> 0) then
  130.       begin
  131.          writeln(char_file);
  132.          write(char_file, '              ');
  133.       end;
  134.       Rolls := Rolls - 1;
  135.    until rolls = 0;
  136.    writeln(Char_file);
  137. end;
  138.  
  139. Procedure Get_Description;
  140.  
  141. var
  142.    Skin : integer;
  143.    Hair : integer;
  144.    Eyes : integer;
  145.    sex : string[6];
  146.    before : boolean;
  147.    rolls: integer;
  148.    other : integer;
  149.  
  150. begin
  151.    Writeln(Char_file, 'Character Description: ');
  152.    Write(Char_file, '   Sex: ');
  153.    if Random(10) > 5 then
  154.       sex := 'Female'
  155.    else sex := 'Male';
  156.    write(char_file, sex, ', ');
  157.    skin := random(5) + random(5) + random(5) +3;
  158.    Write(Char_File, 'Skin Color: ');
  159.    case skin of
  160.       3 : Write(Char_File, 'Blue-Black');
  161.       4..6 : Write(Char_File, 'Black');
  162.       7 : Write(Char_file, 'White with Freckles');
  163.       8 : Write(Char_File, 'White, tanned');
  164.       9..10 : Write(Char_File, 'White');
  165.       11..12 : Write(Char_File, 'Brown');
  166.       13..15 : Write(Char_File, 'Light Golden(Oriental)');
  167.       16 : Write(Char_File, 'Golden');
  168.       17..18 : Write(Char_File, 'Red-Bronze');
  169.    end;
  170.    hair := random(5) + random(5) + random(5) + 3;
  171.    Write(Char_file, ', Hair Color: ');
  172.    case hair of
  173.       3 : Write(Char_File, 'Blue-Black');
  174.       4..5 : Write(Char_File, 'Black');
  175.       6 : Write(Char_File, 'Blond');
  176.       7 : Begin
  177.              if sex = 'male  ' then
  178.                 Write(Char_File, 'Bald')
  179.              else
  180.                  Write(Char_File, 'Blond');
  181.           end;
  182.       8 : Write(Char_file, 'Red-Brown');
  183.       9 : Write(Char_file, 'Light Brown');
  184.       10..11 : Write(Char_File, 'Brown');
  185.       12..13 : Write(Char_File, 'Dark Brown');
  186.       14 : Write(Char_file, 'Grey');
  187.       15 : Write(Char_file, 'Strawberry Blond');
  188.       16 : Write(Char_file, 'Bright Red/Orange');
  189.       17 : Write(Char_file, 'Golden Blond');
  190.       18 : Write(char_file, 'Pure White');
  191.    end;
  192.    Writeln(Char_file);
  193.    Write(Char_File, '   Eye Color: ');
  194.    Before := False;
  195.    Rolls := 1;
  196.    other := 0;
  197.    repeat
  198.    repeat
  199.       eyes := random(5) + random(5) + random(5) + 3;
  200.    until eyes <> other;
  201.    case eyes of
  202.       3 : Write(char_file, 'Purple');
  203.       4 : Write(Char_file, 'Black');
  204.       5 : Write(Char_file, 'Ice-Blue');
  205.       6 : Write(Char_file, 'Gray');
  206.       7..8 : Write(Char_File, 'Blue');
  207.       9..11 : Write(Char_File, 'Brown');
  208.       12 : Write(Char_file, 'Hazel');
  209.       13 : Write(Char_file, 'Green');
  210.       14 : Write(Char_File, 'Dark Blue');
  211.       15..16 :Write(Char_file, 'Dark Green');
  212.       17 : Write(Char_file, 'Golden');
  213.       18 : Begin
  214.               if Before then
  215.                  Rolls := Rolls + 1
  216.               else
  217.               begin
  218.                  Write(char_File, '(Split) ');
  219.                  Rolls := 3;
  220.                  Before := True;
  221.               end;
  222.            end;
  223.    end;
  224.    rolls := rolls - 1;
  225.    other := eyes;
  226.    if before and (rolls = 1) then
  227.       write(Char_file, ', ');
  228.    until rolls = 0;
  229.    writeln(Char_file);
  230. end;
  231.  
  232. Procedure Get_Skills;
  233.  
  234. var
  235.    num_skills : integer;
  236.    skills_array : array[1..3, 3..18] of boolean;
  237.    index : integer;
  238.    index2 : integer;
  239.    chart : integer;
  240.    skill : integer;
  241.    before : boolean;
  242.  
  243. begin
  244.    Writeln(Char_File, 'Skills:');
  245.    write(char_file, '   ');
  246.    num_skills := random(5) + random(5) + 2;
  247.    for Index := 1 to 3 do
  248.       for Index2 := 3 to 18 do
  249.          skills_array[Index, Index2] := false;
  250.    for Index := 1 to Num_Skills do
  251.    begin
  252.       chart := random(2) + 1;
  253.       case chart of
  254.          1 : Begin
  255.                 before := false;
  256.                 repeat
  257.                    skill := random(5) + random(5) + random(5) + 3;
  258.                    If skills_array[chart,skill] = true then
  259.                       before := true
  260.                    else
  261.                       before := false;
  262.                 until not(before);
  263.                 skills_array[chart, skill] := true;
  264.                 case skill of
  265.                    3 : Write(char_file, 'Caligraphy');
  266.                    4 : Write(char_file, 'Botany');
  267.                    5 : Write(char_file, 'Diplomacy');
  268.                    6 : Write(char_file, 'Singing');
  269.                    7 : Write(char_file, 'Animal Handling');
  270.                    8 : Write(char_file, 'Stealth');
  271.                    9 : Write(char_file, 'Hand Weapons(simple)');
  272.                    10 : Write(char_file, 'Hand Weapons(complex)');
  273.                    11 : Write(char_file, 'Running');
  274.                    12 : Write(char_file, 'Missile Weapon(any)');
  275.                    13 : Write(char_file, 'Carousing');
  276.                    14 : Write(char_file, 'Gambling');
  277.                    15 : Write(char_file, 'Musical Instrument(any)');
  278.                    16 : Write(char_file, 'Forgery');
  279.                    17 : Write(char_file, 'Judo or Karate');
  280.                    18 : Write(char_file, 'History');
  281.                 end;
  282.               end;
  283.           2 : Begin
  284.                 before := false;
  285.                 repeat
  286.                    skill := random(5) + random(5) + random(5) + 3;
  287.                    If skills_array[chart,skill] = true then
  288.                       before := true
  289.                    else
  290.                       before := false;
  291.                 until not(before);
  292.                 skills_array[chart, skill] := true;
  293.                 case skill of
  294.                    3 : Write(char_file, 'Armoury');
  295.                    4 : Write(char_file, 'Merchant');
  296.                    5 : Write(char_file, 'Physician');
  297.                    6 : Write(char_file, 'Language(any)');
  298.                    7 : Write(char_file, 'Bard');
  299.                    8 : Write(char_file, 'Scrounging');
  300.                    9 : Write(char_file, 'Fast-Draw(any)');
  301.                    10 : Write(char_file, 'Traps');
  302.                    11 : Write(char_file, 'Brawling');
  303.                    12 : Write(char_file, 'Pilot or Gunner(any)');
  304.                    13 : Write(char_file, 'Law');
  305.                    14 : Write(char_file, 'Streetwise');
  306.                    15 : Write(char_file, 'Survival');
  307.                    16 : Write(char_file, 'Disguise');
  308.                    17 : Write(char_file, 'Naturalist');
  309.                    18 : Write(char_file, 'Navigation');
  310.                 end;
  311.               end;
  312.           3 : Begin
  313.                 before := false;
  314.                 repeat
  315.                    skill := random(5) + random(5) + random(5) + 3;
  316.                    If skills_array[chart,skill] = true then
  317.                       before := true
  318.                    else
  319.                       before := false;
  320.                 until not(before);
  321.                 skills_array[chart, skill] := true;
  322.                 case skill of
  323.                    3 : Write(char_file, 'Biochemistry');
  324.                    4 : Write(char_file, 'Sleight of Hand');
  325.                    5 : Write(char_file, 'Sports(any)');
  326.                    6 : Write(char_file, 'Veterinary');
  327.                    7 : Write(char_file, 'Acting');
  328.                    8 : Write(char_file, 'First Aid');
  329.                    9 : Write(char_file, 'Climbing');
  330.                    10 : Write(char_file, 'Shield');
  331.                    11 : Write(char_file, 'Driving or Riding(any)');
  332.                    12 : Write(char_file, 'Swimming');
  333.                    13 : Write(char_file, 'Savoir-Faire');
  334.                    14 : Write(char_file, 'Politics');
  335.                    15 : Write(char_file, 'Lockpicking');
  336.                    16 : Write(char_file, 'Mechanic');
  337.                    17 : Write(char_file, 'Sex Appeal');
  338.                    18 : Write(char_file, 'Poisons');
  339.                 end;
  340.               end;
  341.       end;
  342.       if (Index <> Num_skills) then
  343.          write(char_file, ', ');
  344.       if ((Index mod 3) = 0) and (Index <> Num_Skills) then
  345.       begin
  346.          writeln(char_file);
  347.          write(char_file, '   ');
  348.       end;
  349.    end;
  350.    writeln(char_file);
  351. end;
  352.  
  353. begin
  354.    Assign(Char_file, 'Npc.fil');
  355.    Rewrite(Char_file);
  356.    clrscr;
  357.    Writeln('GURPS Cyberpunk Random Character Generator');
  358.    Writeln('Written By: Kevin Reynolds');
  359.    Writeln('Version: ',Version:4:2);
  360.    Writeln;
  361.    Writeln(Char_file, 'GURPS Cyberpunk Random Character Generator');
  362.    Writeln(Char_file, 'Written By: Kevin Reynolds');
  363.    Writeln(Char_file, 'Version: ',Version:4:2);
  364.    Writeln(Char_file);
  365.    Write('How many NPC''s to roll out: ');
  366.    readln(Num_Chars);
  367.    Writeln('Generating ', Num_Chars, ' NPC''s. ');
  368.    Writeln(Char_file, 'Generating ', Num_Chars, ' NPC''s. ');
  369.    Writeln(Char_file);
  370.    randomize;
  371.    For Index := 1 to Num_Chars do
  372.    begin
  373.       write(Char_file, 'Char ',Index,': ');
  374.       Roll_Stats;
  375.       Get_Advantage;
  376.       Get_Disadvantage;
  377.       Get_Skills;
  378.       Get_Description;
  379.       Writeln(Char_File);
  380.    end;
  381.    Close(Char_File);
  382.    Writeln('Done.');
  383. end.
  384.